package com.ztc.controller;
import com.ztc.service.BookDao;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
@Controller
@RequestMapping("/user1")
public class AddbookController extends HttpServlet {
    BookDao bookDao = new BookDao();
    public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        doPost(request,response);

    }
    public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        String bookname= request.getParameter("bookname");
        boolean b2 = bookDao.getBookName2(bookname);
        if(b2){
            response.getWriter().write("1");
        }else{
            response.getWriter().write("0");
        }



    }

}
